Skip to content

Conversation

@mofterdinger
Copy link
Collaborator

@mofterdinger mofterdinger commented Oct 15, 2024

Add annotation @Core.ContentDisposition to get fileName on creation of attachment.

With this annotation added, the Fiori UI sends a request containing the fileName to create the attachments:

--batch_id-1729000376682-418
Content-Type:application/http
Content-Transfer-Encoding:binary
 
POST Books(ID=4a519e61-3c3a-4bd9-ab12-d7e0c5329933,IsActiveEntity=false)/covers HTTP/1.1
Accept:application/json;odata.metadata=minimal;IEEE754Compatible=true
Accept-Language:en-US
Content-Type:application/json;charset=UTF-8;IEEE754Compatible=true
 
{"fileName":"catweazle.jpg"}
--batch_id-1729000376682-418--
Group ID: $auto

See also: https://github.com/cap-js/attachments/blob/898eca7a89a84f15c59ce5a85bea117df19952d2/index.cds#L44

@mofterdinger mofterdinger changed the title Add annotation @Core.ContentDisposition to get fileName on creation o… Add annotation @Core.ContentDisposition to get fileName on creation Oct 15, 2024
{Value: note}
]
} {
content @Core.ContentDisposition: { Filename: fileName, Type: 'inline' };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, das hatte ich ganz uebersehen. Es hatte bisher aber nicht funktioniert, der fileName wurde nicht uebertragen. Mit dieser Annotation hat es dann geklappt. Die SDM Kollegen haben danach gefragt.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dann kann man es vielleicht an der anderen Stelle löschen, aber wenn es so funktioniert, dann approve ich mal

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wie ist das mit Annotations bei Aspekten, werden die auch vererbt ? Bisher war diese Annotation beim Aspect MediaData. Hatte das frueher schon mal funktioniert ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ich dachte sie werden vererbt, aber wenn das nicht richtig funktioniert, dann sollten wir alle an den Attachment-Aspect packen, was denkst du?

Copy link
Collaborator Author

@mofterdinger mofterdinger Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scheint ein Bug oder Feature im cds compiler zu sein. Nur wenn ich die Anntation nochmal am Attachment Aspekt mache, bekomme ich die Annotations auch im EDMX zu sehen:

      <Annotations Target="AdminService.Books_covers/content">
        <Annotation Term="Core.ContentDisposition">
          <Record Type="Core.ContentDispositionType">
            <PropertyValue Property="Filename" Path="fileName"/>
            <PropertyValue Property="Type" String="inline"/>
          </Record>
        </Annotation>
        <Annotation Term="Core.MediaType" Path="mimeType"/>
        <Annotation Term="Common.Label" String="{i18n>attachment_content}"/>
      </Annotations>

Das EDMX ist allerdings relevant fuer das Fiori UI.

Ich merge deswegen diesen PR und lasse die Annotation auch am MediaData Aspekt stehen.

@mofterdinger mofterdinger merged commit 2111725 into main Oct 15, 2024
1 check passed
@mofterdinger mofterdinger deleted the add_missing_filename branch October 15, 2024 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants